package com.ramos.kuaixiao.shops.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.ramos.kuaixiao.R;
import com.ramos.kuaixiao.adapter.BaseViewHolder;


/**
 * @Description:gridview的Adapter
 * @author http://blog.csdn.net/finddreams
 */
public class MallGridAdapter extends BaseAdapter {
	private Context mContext;

	public String[] img_text = {"个人信息",  "经销商列表","海蓝宝金融", "更改手机", "更改邮箱",
			"更改密码", "关于我们", "数据更新", "退出登陆"};
	public int[] imgs = {R.drawable.arc, R.drawable.icon_meeting_resolution,
			R.drawable.bi2, R.drawable.arm,
			R.drawable.arh, R.drawable.az0,
			R.drawable.ax9, R.drawable.ari, R.drawable.bf_ };

	public MallGridAdapter(Context mContext) {
		super();
		this.mContext = mContext;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return img_text.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(
					R.layout.grid_item, parent, false);
		}
		TextView tv = BaseViewHolder.get(convertView, R.id.tv_item);
		ImageView iv = BaseViewHolder.get(convertView, R.id.iv_item);
		iv.setBackgroundResource(imgs[position]);

		tv.setText(img_text[position]);
		return convertView;
	}

}
